package com.hmy.contract.service.dto.contract;

import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.springframework.util.StringUtils;

import java.io.Serializable;

/**
 * @author seven.qi 齐胜南
 * @version 1.0
 * @description
 * @date 2024/4/22 20:44
 */
@Data
public class LocationDetailDto implements Serializable {
    private static final long serialVersionUID = -5851076191066028555L;
    /**
     * 省编码
     */
    private String provinceCode;
    /**
     * 省名称
     */
    private String provinceName;
    /**
     * 城市编码
     */
    private String cityCode;
    /**
     * 城市名称
     */
    private String cityName;
    /**
     * 区编码
     */
    private String adCode;
    /**
     * 区名称
     */
    private String adName;
    /**
     * 地址信息
     */
    private String snippet;
    /**
     * poiId
     */
    private String poiId;
    /**
     * 详细地址
     */
    private String addressDetail;
    /**
     * 经度
     */
    private String longitude;
    /**
     * 纬度
     */
    private String latitude;
    /**
     * title
     */
    private String title;
    public String toLocationDetailString() {
        return (StringUtils.isEmpty(provinceName) ? "" : provinceName) +
                (StringUtils.isEmpty(cityName) ? "" : cityName) +
                (StringUtils.isEmpty(adName) ? "" : adName) +
                (StringUtils.isEmpty(snippet) ? "" : snippet) +
                (StringUtils.isEmpty(addressDetail) ? "" : addressDetail);
    }
    @JsonIgnore
    public boolean empty() {
        return StrUtil.isAllEmpty(provinceCode, provinceName, cityCode, cityName, adCode, adName, snippet, poiId, addressDetail, longitude, latitude, title);
    }
}
